<%@ taglib prefix="a" uri="http://java.sun.com/jmaki" %>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<jsp:useBean id="event" scope="session" class="com.asaga.tools.Event_DBImpl" />
<jsp:useBean id="client" scope="session" class="com.asaga.tools.SystemClient_DBImpl" />
<jsp:useBean id="location" scope="session" class="com.asaga.tools.Location_StubImpl" />
<jsp:useBean id="venue" scope="page" class="com.asaga.tools.LocationVenue" />

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%  
String username = (String)session.getAttribute("username");
if(username==null){
    response.sendRedirect("login.jsp?message=Please log in again.");
}
%>

<html>
    <head>
        <title>ASAA-GGC</title>
        <style title="text/css">@import "style.css"; </style>
        <link rel="stylesheet" href="css/gray.css" type="text/css" title="gray">
        <link rel="stylesheet" href="css/autism.css" type="text/css" />
        <link rel="alternate stylesheet" type="text/css" href="css/red.css" title="red">
        <link rel="alternate stylesheet" type="text/css" href="css/blue.css" title="blue">
        <link rel="alternate stylesheet" type="text/css" href="css/orange.css" title="orange">
        <script type="text/javascript" src="javascript/styleswitcher.js"></script>
        <script type="text/javascript" src="javascript/formhandler.js"></script>
    </head>
    
    
    <body onload="javascript:hide(document.getElementById('locationForm'))">
        <div class="main">
            <%@ include file="header.html" %>
            <div id="content">
                <h2>WELCOME, <%=username%>! (<a href="AutismSiteMasterController?action=logoff">Logout</a>)
                    <div id="colorchange">
                        <ul>
                            <li><a href="#" onclick="setActiveStyleSheet('gray'); return false;" title="Gray Theme"><img src="images/btngray.gif" alt="Gray Theme" /></a></li>
                            <li><a href="#" onclick="setActiveStyleSheet('red'); return false;" title="Red Theme"><img src="images/btnred.gif" alt="Red Theme" /></a></li>
                            <li><a href="#" onclick="setActiveStyleSheet('blue'); return false;" title="Blue Theme"><img src="images/btnblue.gif" alt="Blue Theme" /></a></li>
                            <li><a href="#" onclick="setActiveStyleSheet('orange'); return false;" title="Organe Theme"><img src="images/btnorange.gif" alt="Orange Theme" /></a></li>
                        </ul>
                    </div>
                </h2>
                <p id="warning"><jsp:getProperty name="event" property="warningMessage" />
                </p>
                
                <h4 class="heading">Add an Event</h4><br />
                <form method="get" action="AutismSiteMasterController">
                    <fieldset>
                        <legend>Event Information</legend>
                        <table class="eventForm">
                            <tr><td>
                                    Event Title:
                                </td>
                                <td><input type="text" name="title" value="<jsp:getProperty name="event" property="title" />" size="40" />
                                </td>
                            </tr>
                            <tr><td>
                                    Start Date:
                                </td>
                                <td>
                                    <input type="text" name="startDate" value="" size="10" />
                                </td>
                            </tr>
                            <tr><td>
                                    End Date:
                                </td>
                                <td><input type="text" name="endDate" value="" size="10" />
                                    
                                </td>
                            </tr>
                            <tr><td>
                                    Start Time:
                                </td>
                                <td><select name="starthr">
                                        <option>01</option>
                                        <option>02</option>
                                        <option>03</option>
                                        <option>04</option>
                                        <option>05</option>
                                        <option>06</option>
                                        <option>07</option>
                                        <option>08</option>
                                        <option>09</option>
                                        <option>10</option>
                                        <option>11</option>
                                        <option>12</option>
                                    </select> : 
                                    <select name="startmin">
                                        <option>00</option>
                                        <option>30</option>
                                    </select>  
                                     <select name="startmer">
                                        <option>AM</option>
                                        <option>PM</option>
                                    </select>
                                </td>
                            </tr>
                            <tr><td>
                                    End Time:
                                </td>
                                <td><select name="endhr">
                                        <option>01</option>
                                        <option>02</option>
                                        <option>03</option>
                                        <option>04</option>
                                        <option>05</option>
                                        <option>06</option>
                                        <option>07</option>
                                        <option>08</option>
                                        <option>09</option>
                                        <option>10</option>
                                        <option>11</option>
                                        <option>12</option>
                                    </select> : 
                                    <select name="endmin">
                                        <option>00</option>
                                        <option>30</option>
                                    </select>  
                                     <select name="endmer">
                                        <option>AM</option>
                                        <option>PM</option>
                                    </select>
                                </td>
                            </tr>
                            <tr><td>Saved Locations:
                                </td>
                                <td>
                                    <select name="locationid">
                                        <option value="" onclick="javascript:hide(document.getElementById('locationForm'))">-- Select a Location -- </option>
                                        <%  int i = 0;
                                        while(location.getVenueById(i) != null){%>
                                        <option value="<%=location.getVenueById(i).getId()%>" onclick="hide(document.getElementById('locationForm'))"><%=location.getVenueById(i).getTitle()%>,
                                        <%=location.getVenueById(i).getCity()%>, <%=location.getVenueById(i).getState()%></option>
                                        <% i++;
                                        }%>
                                        <option value="notlisted" onclick="javascript:show(document.getElementById('locationForm'))">Not Listed</option>
                                    </select>
                            </td></tr>
                        </table>
                    </fieldset>
                    <!--<a href="javascript:hideshow(document.getElementById('locationForm'))">Hide Show</a> -->
                        
                    
                    <div id="locationForm">
                        <h4>Add Your Location </h4>
                        <fieldset>
                            <legend>Location Information</legend>
                            <table class="eventForm">
                                <tr><td>Location Name:
                                    </td>
                                    <td><input type="text" name="locationTitle" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Street Address:
                                    </td>
                                    <td><input type="text" name="addr1" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Address Line 2:
                                    </td>
                                    <td><input type="text" name="addr2" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        City:
                                    </td>
                                    <td><input type="text" name="city" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        State:
                                    </td>
                                    <td><input type="text" name="state" value="" size="10" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Zip:
                                    </td>
                                    <td><input type="text" name="zip" value="" size="10" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Location Website:
                                    </td>
                                    <td><input type="text" name="website" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Contact Name:
                                    </td>
                                    <td><input type="text" name="contactName" value="" size="40" />
                                    </td>
                                </tr>
                                <tr><td>
                                        Contact Email:
                                    </td>
                                    <td><input type="text" name="contactEmail" value="" size="40" />
                                    </td>
                                </tr>
                            </table>
                        </fieldset>
                    </div>
                    <input type="hidden" name="action" value="addevent" />
                    <input type="submit" value="submit" name="submit" />
                </form>     
                
            </div>
        </div>
        <%@ include file="footer.html" %>       
    </body>
</html>
